<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /*提前准备一个样式*/
        .Test1{
            color: yellowgreen;
            background: pink;
        }
    </style>
</head>
<body>
    <div class = "Test">测试内容1</div>
    <button>测试按钮1</button>
    <script>
        var div1 = document.querySelector('div');
        var btn1 = document.querySelector('button');
        btn1.onclick = function(){
            div1.className = 'Test1';
        }
    </script>
</body>
</html>